<?php

class Config_Model extends CI_Model {

    private $table = 'configs';

    public function __construct() {
        parent::__construct();
        $this->load->database();
    }

    public function get($where = NULL, $key = NULL) {
        if (empty($where) == FALSE) {
            $this->db->where($where);
        }

        if (empty($key) == FALSE) {
            $this->db->like('key', $key);
        }

        $query = $this->db->get($this->table);
        return is_object($query) ? $query->result_array() : FALSE;
    }

    public function create($data) {
        return $this->db->insert($this->table, $data);
    }

    public function update($args, $data) {
        $this->db->where($args);
        return $this->db->update($this->table, $data);
    }

}
